import time
def bb(nums):
    sp = True
    while sp:
        sp = False
        for i in range(len(nums)-1):
            if nums[i] > nums[i+1]:
                nums[i], nums[i+1] = nums[i+1], nums[i]
                sp = True

def rd(filename):
    file = open(filename, 'r')
    data = file.readlines()
    return data

m1 = rd("m1_sorted.txt")
m2 = rd("m2_reverse.txt")
m3 = rd("m3_shuffle.txt")

t_start = time.time()
bb(m1)
t_finish = time.time()
print("m1_sorted.txt", round((t_finish-t_start)*1000), "milliseconds")

t_start = time.time()
bb(m2)
t_finish = time.time()
print("m2_reverse.txt", round((t_finish-t_start)*1000), "milliseconds")

t_start = time.time()
bb(m3)
t_finish = time.time()
print("m3_shuffle.txt", round((t_finish-t_start)*1000), "milliseconds")
